using System.Windows.Forms;
using System.Xml;

namespace SPDevExplorer
{
    public class FolderProperties : SharePointProperties
    {
        public FolderProperties(TreeNode n) : base(n)
        {
        }

        public FolderProperties(XmlElement xml) : base(xml)
        {
        }

        public int ItemCount
        {
            get { return int.Parse(Xml.GetAttribute("ItemCount")); }
        }

        public int FolderCount
        {
            get { return int.Parse(Xml.GetAttribute("FolderCount")); }
        }

        public bool IsDocumentLibrary
        {
            get { return bool.Parse(Xml.GetAttribute("IsDocumentLibrary")); }
        }

        public string Description
        {
            get { return Xml.GetAttribute("Description"); }
        }

        public bool EnableMinorVersions
        {
            get { return (Xml.GetAttribute("EnableMinorVersions") == bool.TrueString); }
        }

        public bool EnableModeration
        {
            get { return (Xml.GetAttribute("EnableModeration") == bool.TrueString); }
        }

        public bool ForceCheckout
        {
            get { return (Xml.GetAttribute("ForceCheckout") == bool.TrueString); }
        }

        public bool EnableVersioning
        {
            get { return (Xml.GetAttribute("EnableVersioning") == bool.TrueString); }
        }

        public bool IsSystem
        {
            get { return (Xml.GetAttribute("System") == bool.TrueString); }
        }

        public bool IsValidFolder
        {
            get { return Xml.Name == "Folder"; }
        }

        public bool ReadOnly
        {
            get { return Xml.GetAttribute("ReadOnly") == "True"; }
        }
    }
}